/** File name: imageProcessing.cu
*** Author: Tran Van Hoang
*** Date: 8/5/2015
***/

#include "cellNetwork.h"
#include "imageprocessing.h"
#include "ForestFed/dataForest.cu"
#include <stdio.h>
#include <malloc.h>

int main()
{

	CellArray *resultCells;
	int nbNode, nbNode2;
	nbNode = 0;
	FILE *f;

	f = fopen("imageProcessing.txt", "w");

	resultCells = (CellArray*) malloc(4 * NODE_NUMBER_FOREST * sizeof(CellArray));

	resultCells2 = (CellArray*) malloc(4 * NODE_NUMBER_FOREST * sizeof(CellArray));

	dilatingCellNetwork(Cells, resultCells, NODE_NUMBER_FOREST, nbNode);

	erodingCellNetwork(resultCells, resultCells2, nbNode, nbNode2);

 	//erodingCellNetwork(Cells, resultCells, NODE_NUMBER_FOREST, nbNode);
	for (int i = 0; i < nbNode2; i++)
	{
	    fprintf(f, "\n%d: x=%d, y=%d", i, resultCells[i].position.x, resultCells[i].position.y);
	}

	//gettingBoundary(Cells, resultCells, NODE_NUMBER_FOREST, nbNode);
	
	printf("\nOrigin: %d - Result: %d\n", NODE_NUMBER_FOREST, nbNode2);

	fclose(f);
	return 0;
}
